<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['供应链管理','品质管理','来料检验报表']" icon="fa fa-cogs"
			class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>

	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span>
					<h2>来料检验报表</h2>
				</header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn" style="width: calc(100% - 220px);">
								<!-- <div class="top_module top_module_box">
									<span class="module_text">检验日期</span>
									<input type="text" class="module_inp top_module_select" id="checkDate"
										[(ngModel)]="tableSearch.checkDate" placeholder="检验日期" />
								</div> -->
								<div class="selectDate top_module">
									<div class="input-daterange input-group s_selected_time_box s_hover_box">
										<input type="text" [(ngModel)]='startTime' class="form-control s_selected_time"
											id="datetimepicker1" autocomplete="off" placeholder="选择检验开始时间" />
										<span class="s_selected_time_spe">至</span>
										<input type="text" [(ngModel)]='endTime' class="form-control s_selected_time"
											id="datetimepicker2" autocomplete="off" placeholder="选择检验结束时间" />
										<div class="s_del_icon" (click)='del_date()'>x</div>
									</div>
								</div>
								<div class="top_module top_module_box">
									<span class="module_text">物料编码</span>
									<input type="text" class="module_inp top_module_select"
										[(ngModel)]="tableSearch.materialCode" placeholder="物料编码" />
								</div>
								<div class="top_module top_module_box">
									<span class="module_text">物料名称</span>
									<input type="text" class="module_inp top_module_select"
										[(ngModel)]="tableSearch.materialName" placeholder="物料名称" />
								</div>
								<div class="top_module top_module_box">
									<span class="module_text">供应商</span>
									<input type="text" class="module_inp top_module_select"
										[(ngModel)]="tableSearch.supplier" placeholder="供应商" />
								</div>
								<div class="top_module top_module_box" style="min-width: auto;">
									<span class="top_module_label module_text">物料类别</span>
									<select name="" class="top_module_select" [(ngModel)]="tableSearch.materialType"
										style="min-width: 110px;">
										<option value="">全部</option>
										<option value="1">主机</option>
										<option value="2">传感器</option>
										<option value="3">线材</option>
										<option value="4">天线</option>
										<option value="5">基座</option>
										<option value="6">显示器</option>
									</select>
								</div>
								<div class="top_module top_module_box" style="min-width: auto;">
									<span class="top_module_label module_text">检验结果</span>
									<select name="" class="top_module_select" [(ngModel)]="tableSearch.checkResult"
										style="min-width: 110px;">
										<option value="">全部</option>
										<option value="1">合格</option>
										<option value="2">特采</option>
										<option value="3">挑选</option>
										<option value="4">退货</option>
									</select>
								</div>
								<button class="btn btn-primary" (click)="table_search()">查询</button>
								<button class="btn btn-primary" (click)="table_add(IncomingInspectReportModal)"
									*ngIf="isShowAdd">新增</button>
								<button type="button" class="btn btn-primary" (click)="dataExceport()">导出</button>
							</div>
						</div>
						<div class="table_scroll">
							<table
								class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>检验日期</th>
										<th>物料编码</th>
										<th>物料名称</th>
										<th>物料规格描述</th>
										<th>供应商</th>
										<th>物料类别</th>
										<th>来料数量</th>
										<th>抽检数量</th>
										<th>不良数量</th>
										<th>不良率</th>
										<th>检验结果</th>
										<th>不良现象描述</th>
										<th>处理对策</th>
										<th>检验员</th>
										<th>创建时间</th>
										<th>创建人</th>
										<th>更新时间</th>
										<th>更新人</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData; let i = index" [attr.data-index]="i">
										<td>{{row.checkDate.substring(0,10)}}</td>
										<td>{{row.materialCode}}</td>
										<td>{{row.materialName}}</td>
										<td>{{row.materialDesc}}</td>
										<td>{{row.supplier}}</td>
										<td>
											<span *ngIf="row.materialType == 1">主机</span>
											<span *ngIf="row.materialType == 2">传感器</span>
											<span *ngIf="row.materialType == 3">线材</span>
											<span *ngIf="row.materialType == 4">天线</span>
											<span *ngIf="row.materialType == 5">基座</span>
											<span *ngIf="row.materialType == 6">显示器</span>
										</td>
										<td>{{row.comMaterialNum}}</td>
										<td>{{row.spotCheckNum}}</td>
										<td>{{row.badNumber}}</td>
										<td>{{row.badRatio}}%</td>
										<td>
											<span *ngIf="row.checkResult == 1">合格</span>
											<span *ngIf="row.checkResult == 2">特采</span>
											<span *ngIf="row.checkResult == 3">挑选</span>
											<span *ngIf="row.checkResult == 4">退货</span>
										</td>
										<td>{{row.descOfBad}} <button *ngIf="row.imageOfBad" type="button"
												(click)="showImg1(row.imageOfBad,imgModal)">查看</button></td>
										<td>{{row.descOfHandle}} <button *ngIf="row.imageOfHandle" type="button"
												(click)="showImg1(row.imageOfHandle,imgModal)">查看</button>
										</td>
										<td> {{row.examiner}}</td>
										<td>{{row.createTime}}</td>
										<td>{{row.createName}}</td>
										<td>{{row.updateTime}}</td>
										<td>{{row.updateName}}</td>
										<td>
											<button type="button" (click)="editRow(row,IncomingInspectReportModal)"
												*ngIf="isShowEdit">编辑</button>
											<button type="button" (click)="deleteRow(row)" *ngIf="isShowDel">删除</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount" [rows]="pageSize" [currentPage]="curPage - 1"
								(onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i
									class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>

	<!--    弹窗-->
	<section bsModal #IncomingInspectReportModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
		aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="modalClose(IncomingInspectReportModal)"
						aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title">来料检验报表 - <span *ngIf="formType == 'new'">新增</span><span
							*ngIf="formType == 'updata'">编辑</span></h4>
				</div>
				<form id="IncomingInspectReportForm" class="form-horizontal" role="form" novalidate="novalidate"
					[saBootstrapValidator]="validatorOptions">
					<div class="modal-body">
						<div class="row form-horizontal">
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">检验日期<sup>*</sup></label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" id="inspectDateAdd"
										[(ngModel)]='IncomingInspectReportForm.checkDate' name='checkDate' />
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">物料编码<sup>*</sup></label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" [(ngModel)]='IncomingInspectReportForm.materialCode'
										name='materialCode' />
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">物料名称<sup>*</sup></label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" [(ngModel)]='IncomingInspectReportForm.materialName'
										name='materialName' />
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">物料规格描述<sup>*</sup></label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" [(ngModel)]='IncomingInspectReportForm.materialDesc'
										name='materialDesc' />
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">供应商<sup>*</sup></label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" [(ngModel)]='IncomingInspectReportForm.supplier'
										name='supplier' />
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="control-label col-xs-2 no-padding-right">物料类别<sup>*</sup></label>
								<div class="col-xs-10">
									<select class="form-control" name="materialType"
										[(ngModel)]='IncomingInspectReportForm.materialType' style="width: 100%">
										<option value="">请选择</option>
										<option value="1">主机</option>
										<option value="2">传感器</option>
										<option value="3">线材</option>
										<option value="4">天线</option>
										<option value="5">基座</option>
										<option value="6">显示器</option>
									</select>
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">来料数量<sup>*</sup></label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" [(ngModel)]='IncomingInspectReportForm.comMaterialNum'
										name='comMaterialNum' onkeyup="value=value.replace(/[^\d]/g,'')" (ngModelChange)="validateChange('comMaterialNum')"/>
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">抽检数量<sup>*</sup></label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" [(ngModel)]='IncomingInspectReportForm.spotCheckNum'
										name='spotCheckNum' onkeyup="value=value.replace(/[^\d]/g,'')" (ngModelChange)="validateChange('spotCheckNum')"/>
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">不良数量<sup>*</sup></label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" [(ngModel)]='IncomingInspectReportForm.badNumber'
										name='badNumber' onkeyup="value=value.replace(/[^\d]/g,'')" (ngModelChange)="validateChange('badNumber')"/>
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="control-label col-xs-2 no-padding-right">检验结果<sup>*</sup></label>
								<div class="col-xs-10">
									<select class="form-control" name="checkResult"
										[(ngModel)]='IncomingInspectReportForm.checkResult' style="width: 100%">
										<option value="">请选择</option>
										<option value="1">合格</option>
										<option value="2">特采</option>
										<option value="3">挑选</option>
										<option value="4">退货</option>
									</select>
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">不良现象描述 </label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" [(ngModel)]='IncomingInspectReportForm.descOfBad'
										name='descOfBad' />
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="control-label col-xs-2">不良现象图片</label>
								<div class="col-xs-10">
									<div class="imgFileList">
										<div class="imgFileList-other">
											<div class="imgFileList-multifile">
												<div class="uploadlocation uploadlocation1">
													<div class="content-list">
														<div class="headImg"
															*ngFor="let item of IncomingInspectReportForm.imageOfBad; let i = index">
															<div class="contentImg"><img class="img" alt="不良现象图片"
																	[src]="item" (click)="bigImgClick()"></div>
															<i class="deleteImg"
																(click)="deleteImg('1',i,'imageOfBad')"></i>
														</div>
														<button type="button" class="btn div_imgall"
															*ngIf="IncomingInspectReportForm.imageOfBad.length<3">
															<div class="div_shuline"></div>
															<div class="div_hengline"></div>
															<input type="file" class="up" title=" " placeholder=" "
																multiple
																(change)="multifileChange($event.target.files,'imageOfBad')" />
														</button>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">处理对策 </label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" [(ngModel)]='IncomingInspectReportForm.descOfHandle'
										name='descOfHandle' />
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="control-label col-xs-2">处理对策图片</label>
								<div class="col-xs-10">
									<div class="imgFileList">
										<div class="imgFileList-other">
											<div class="imgFileList-multifile">
												<div class="uploadlocation uploadlocation1">
													<div class="content-list">
														<div class="headImg"
															*ngFor="let item of IncomingInspectReportForm.imageOfHandle; let i = index">
															<div class="contentImg"><img class="img" alt="处理对策图片"
																	[src]="item" (click)="bigImgClick()"></div>
															<i class="deleteImg"
																(click)="deleteImg('1',i,'imageOfHandle')"></i>
														</div>
														<button type="button" class="btn div_imgall"
															*ngIf="IncomingInspectReportForm.imageOfHandle.length<3">
															<div class="div_shuline"></div>
															<div class="div_hengline"></div>
															<input type="file" class="up" title=" " placeholder=" "
																multiple
																(change)="multifileChange($event.target.files,'imageOfHandle')" />
														</button>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">检验员<sup>*</sup></label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" [(ngModel)]='IncomingInspectReportForm.examiner'
										name='examiner' />
								</div>
							</div>
							<!-- <div class="form-group col-xs-12">
								<label class="control-label col-xs-2 no-padding-right">账户类型<sup>*</sup></label>
								<div class="col-xs-10">
									<select class="form-control" name="accountType" [(ngModel)]='IncomingInspectReportForm.accountType' style="width: 100%">
										<option value="">请选择</option>
										<option value="1">水泥厂</option>
										<option value="2">中间商</option>
									</select>
								</div>
							</div> -->
							<!-- <div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">账户名称<sup>*</sup></label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" [(ngModel)]='IncomingInspectReportForm.accountName' name='accountName' />
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">备注</label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" [(ngModel)]='IncomingInspectReportForm.remark' name='remark' />
								</div>
							</div> -->
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default"
							(click)="modalClose(IncomingInspectReportModal)">取消</button>
						<button type="button" class="btn btn-primary"
							(click)="apiControlSubmit(IncomingInspectReportModal)">确认</button>
					</div>
				</form>
			</div>
		</div>
	</section>
	<!--  弹窗end-->

	<!-- 图片查看   弹窗-->
	<section bsModal #imgModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
		aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content" style="width: 570px;">
				<div class="modal-header">
					<button type="button" class="close" (click)="closeImgModal1(imgModal)" aria-label="Close"><span
							aria-hidden="true">&times;</span></button>
					<h4 class="modal-title">图片</h4>
				</div>
				<div class="modal-body">
					<div class="imagesInfo1">
						<div class="imgShow" *ngFor="let item of imgLocalList" (click)="bigimg()">
							<img [src]="item" style="cursor: pointer;" />
						</div>
					</div>
				</div>
			</div>
		</div>
	</section>
	<!-- 图片查看 弹窗end-->
</div>